<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    {include file="public/static" /}
</head>
<body>

{include file="public/nav" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5" >
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i>搜索</button>
                            <a href="%s">
                                <button type="button" class="layui-btn"><i class="layui-icon">&#xe639;</i>清空</button>
                            </a>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    %s
                </div>
                <div class="layui-card-body layui-table-body">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th>
                                    <input type="checkbox" lay-filter="checkbox" name="id" value="" lay-skin="primary">
                                </th>
%s
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {volist name="info" id="vo"}
                                <tr>
                                    <td>
                                        <input type="checkbox" name="id[]" value="%s" lay-skin="primary">
                                    </td>
%s
                                </tr>
                            {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {$info|raw}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    /**全选*/
    common.selectCheckbox('checkbox','id[]');
    /**批量删除*/
    function dataDelAll() {
        //获取checkbox值
        var ids = common.getCheckboxVal();
        if(ids.length < 1){
            layer.msg('请选择需要操作的数据！',{time:1500, icon:5});
            return false;
        }
        layer.confirm('确认要删除选中的数据吗？',function(){
            var index = layer.load();
            $.ajax({
                type: 'delete', url: "%s", data: {ids:ids}, dataType:'json',
                success:function(data){
                    if(data.status === 1){
                        layer.msg(data.info,{time:1500, icon:6},function(){
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.info,{time:1500, icon:5});
                    }
                    layer.close(index);
                },
                error:function(){
                    layer.close(index);
                    layer.msg("不好意思，出现了一点问题", {icon: 5});
                }
            });
        });
    }
    /**单个删除*/
    function dataDel(obj, id){
        layer.confirm('确认要删除这条数据吗？',function(){
            var index = layer.load();
            //发异步删除数据
            $.ajax({
                type:"delete", url:"%s", data:{id:id}, dataType:'json',
                success:function (data) {
                    if(data.status === 1){
                        $(obj).parents("tr").remove();
                        layer.msg(data.info, {icon: 6,time:1500});
                    }else{
                        layer.msg(data.info, {icon: 5,time:1500});
                    }
                    layer.close(index);
                },
                error:function (data) {
                    layer.close(index);
                    layer.msg("不好意思，出现了一点问题", {icon: 5});
                }
            });
        });
    }
    /**数据导出*/
    function dataExport(){
        layer.confirm('确认导出筛选的数据吗？',function(){
            //数据
            var info = {};
            if(info.length <= 0){
                layer.msg("请完善导出字段", {icon: 5});
                return false
            }
            //导出
            var url = "%s";
            var unlink = "{:url('Login/unlinkFile')}";
            common.dataExport(info,url,unlink);
        });
    }
</script>
</html>